package cn.wolfcode.enums;

import lombok.Getter;


@Getter
public enum ConsumptionEnums {
    CONSUME("待结算",0),
    AUDIT("待审核",1),
    FINISH("归档",2),
    FAILURE("坏账",3);
    private String name;
    private Integer value;
    ConsumptionEnums(String name, Integer value){
        this.name=name;
        this.value=value;
    }

    public static String findName(Integer value){
        //得所有的枚举对象
        ConsumptionEnums[] values = ConsumptionEnums.values();
        for (ConsumptionEnums consumptionEnums:values){
            //遍历枚举对象,对比value将符合的name返回
            if (consumptionEnums.value.equals(value)){
                return consumptionEnums.name;
            }
        }
        return null;
    }
}
